package com.kmagsoft.jconvert.gui;



/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */



import gr.anagnosg.general.utils.PropertiesUtils;
import gr.anagnosg.image.imagemagick.ImageMagickUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Properties;

/**
 *
 * @author anagnosg
 */
public class ApplicationParams {
    public static String INSTALLATION_PATH="";
    public static String IMAGE_MAGICK_PATH="";
    public static String IMAGE_SEARCH_MAGICK_PATH="";
    public static String OS="";
    public static void initBatchConvertParams() throws FileNotFoundException {
        FileReader input = new FileReader("application.properties");//pplicationParams.class.getResourceAsStream("../application.properties");// getResourceAsStream("application.properties");
        Properties prop = PropertiesUtils.loadProperties(input,true);
        PropertiesUtils.printAllProperties(prop);
        INSTALLATION_PATH=prop.getProperty("INSTALLATION_PATH");
        IMAGE_MAGICK_PATH=prop.getProperty("IMAGE_MAGICK_PATH");
        //FIND IF IS WINDOWS OR LINUX OS.
        if(File.separatorChar=='/'){
            OS="LINUX";
        }
        else{
            OS="WINDOWS";
        }
        if(OS.equals("WINDOWS")){
            IMAGE_SEARCH_MAGICK_PATH=prop.getProperty("IMAGE_SEARCH_MAGICK_PATH_WIN");
        }
        else{
            IMAGE_SEARCH_MAGICK_PATH=prop.getProperty("IMAGE_SEARCH_MAGICK_PATH_LINUX");
        }
        System.out.println("IMAGE_SEARCH_MAGICK_PATH:"+IMAGE_SEARCH_MAGICK_PATH);
        ImageMagickUtils.initPaths(IMAGE_SEARCH_MAGICK_PATH);
    }
    
}
